//
//  FWViewController.m
//  SegmentBar
//
//  Created by acct<blob>=0xE4BAA6616E64E5BF83  447246and457703 on 12/04/2017.
//  Copyright (c) 2017 acct<blob>=0xE4BAA6616E64E5BF83  447246and457703. All rights reserved.
//

#import "FWViewController.h"
#import "SegmentBarViewController.h"

@interface FWViewController ()
@property (weak, nonatomic) SegmentBarViewController *segmentBarVC;
@end

@implementation FWViewController

- (SegmentBarViewController *)segmentBarVC{
    if (_segmentBarVC == nil) {
        SegmentBarViewController *segmentBarVC = [[SegmentBarViewController alloc] init];
        [self addChildViewController:segmentBarVC];
        _segmentBarVC = segmentBarVC;
    }
    return _segmentBarVC;
    
}

- (void)viewDidLoad{
    [super viewDidLoad];
    self.segmentBarVC.view.frame = self.view.bounds;
    [self.view addSubview:self.segmentBarVC.view];
    
    
    NSArray *items = @[@"专辑", @"声音", @"下载中"];
    
    // 添加几个自控制器
    // 在contentView, 展示子控制器的视图内容
    
    UIViewController *vc1 = [UIViewController new];
    vc1.view.backgroundColor = [UIColor redColor];
    
    UIViewController *vc2 = [UIViewController new];
    vc2.view.backgroundColor = [UIColor greenColor];
    
    UIViewController *vc3 = [UIViewController new];
    vc3.view.backgroundColor = [UIColor yellowColor];
    
    [self.segmentBarVC setUpWithItems:items childVCs:@[vc1, vc2, vc3]];
    [self.segmentBarVC.segmentBar updateWithConfig:^(SegmentBarConfig *config) {
        config.indicatorHeight = 2;
        config.segmentBarBackColor = [UIColor yellowColor];
        config.segmentHeight = 100;
    }];
}




@end
